﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DIWAGIS.Class;

namespace DIWAGIS.Bando
{
    public partial class Form_AttributeLabel : Form
    {
        public Form_AttributeLabel()
        {
            InitializeComponent();
        }

        private void Form_AttributeLabel_Load(object sender, EventArgs e)
        {
            for (int i = 5; i <= 120; i++) comboBoxSizeFont.Items.Add(i);
            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // Get the array of FontFamily objects into ComboBox.
            FontFamily[] fontFamilies;
            fontFamilies = installedFontCollection.Families;
            int count = fontFamilies.Length;
            for (int i = 0; i < fontFamilies.Length; ++i)
            {
                comboBoxFonts.Items.Add(fontFamilies[i].Name);
            }
        }

        private void comboBoxSizeFont_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBoxSize.Text = comboBoxSizeFont.Text.Trim();
        }

        private void buttonColor_Click(object sender, EventArgs e)
        {
            // Show the color dialog.
            colorDialog1.AllowFullOpen = true;
            DialogResult result = colorDialog1.ShowDialog();
            // See if user pressed ok.
            if (result == DialogResult.OK)
            {
                // Set form background to the selected color.
                textBoxColor.BackColor = colorDialog1.Color;
                textBoxColor.Text = "R:"+ colorDialog1.Color.R.ToString() + "; B:"+ colorDialog1.Color.B.ToString() + "; G:"+colorDialog1.Color.G.ToString();
                ClassVariables.labelRed = colorDialog1.Color.R;
                ClassVariables.labelBlue = colorDialog1.Color.B;
                ClassVariables.labelGreen = colorDialog1.Color.G;
            }
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textBoxSize.Text.Trim()!="") ClassVariables.labelSize = Convert.ToInt32(textBoxSize.Text.Trim());
            if (comboBoxFonts.Text.Trim()!="") ClassVariables.labelFont = comboBoxFonts.Text.Trim();
            if (checkBoxBold.Checked == true) ClassVariables.labelBold = true;
            if (checkBoxItalic.Checked == false) ClassVariables.labelItalic = false;
            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            ClassVariables.labelRed = 0;
            ClassVariables.labelBlue = 0;
            ClassVariables.labelGreen = 0;
            this.Close();
        }

        private void checkBoxBold_CheckedChanged(object sender, EventArgs e)
        {

        }
    }
}
